import java.util.Objects;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: Lenovo
 * Date: 2025-04-01
 * Time: 8:00
 */
class Student {
    String name;
    int age;
    int sno;

    public Student(String name, int age, int sno) {
        this.name = name;
        this.age = age;
        this.sno = sno;
    }


    //重写hashcode()方法
    @Override
    public int hashCode() {
        return Objects.hash(name, age, sno);
    }

    public static void main(String[] args) {
        Student s1 = new Student("张三", 25,20);
        Student s2 = new Student("张三", 25,20);
        System.out.println("s1.hashCode():" + s1.hashCode());
        System.out.println("s2.hashCode():" + s2.hashCode());
    }
}
/*
输出：
        s1.hashCode():744698915
        s2.hashCode():744698915*/
